Media streaming with NC14 endpoint#2524
Conversation
|
For such PR that need a library PR, I guess the best is to reference the branch directly, or? --> I am not sure how to handle this best… |
| // Parse the response | ||
| JSONObject respJSON = new JSONObject(response); | ||
| String url = (String) respJSON.getJSONObject(NODE_OCS).getJSONObject(NODE_DATA).get(NODE_URL); | ||
|
|
There was a problem hiding this comment.
couldn't you just use getString instead of get()+cast ?
|
Shouldn't stream just be the default instead of having a dedicated stream menu button? What does "stream" means to say, my grandma? |
| mFileActivity.startActivity(Intent.createChooser(openFileWithIntent, | ||
| mFileActivity.getString(R.string.stream))); | ||
| } | ||
| }).start(); |
There was a problem hiding this comment.
optional: What about using a lambda and putting the whole run() code into a separate method?
|
|
||
| new LoadStreamUrl(this, client).execute(getFile().getLocalId()); | ||
| } catch (Exception e) { | ||
| Log_OC.e(TAG, "Loading stream url not possible: " + e.getMessage()); |
There was a problem hiding this comment.
shouldn't we also add the exception itself to the log statement?
| R.string.stream_not_possible_message, R.drawable.file_movie); | ||
| } | ||
| } else { | ||
| Log_OC.e(TAG, "Error streaming file: no previewMediaFragment!"); |
There was a problem hiding this comment.
Same here: shouldn't we also add the exception itself to the log statement?
There was a problem hiding this comment.
Here is no exception.
It happens when fragment is null.
|
Just some minor code comments
I agree it should be the default cation when clicking on an item (that can be streamed in general) and I remember that this is also what Tobias told me :) |
|
It is: if you click on audio/video it will try to stream the file with our internal player. If our internal player fails, it says "Please download media instead or use external app.". |
| return mMediaController; | ||
| } | ||
|
|
||
| private static class LoadStreamUrl extends AsyncTask<String, Void, String> { |
There was a problem hiding this comment.
Is there no other way but an AsyncTask? I thought we got rid of this ages ago :P
|
To further clarify my comment on AsyncTasks: TobiasK: as for media streaming: I'd appreciate if we'd move away from asynctasks, especially for new code |
|
For up/downloading I agree to use services or jobs/eventbus. So I would go for this:
|
|
Ah. Service or Job can be ran right away too, but I just noticed that it's a simple fetching of url, not of an actual image. Regardless, shouldn't we do it differently in a way that survives rotations etc instead of having to worry about these things? |
|
Would be great to get this in. NC14 will go into freeze soon. So having a client that uses it will allow us to properly test it. |
11c45f0 to
88fd930
Compare
|
Rebased & ready for final review |
Codecov Report
@@ Coverage Diff @@
## master #2524 +/- ##
=========================================
+ Coverage 6.4% 6.42% +0.02%
=========================================
Files 294 297 +3
Lines 29450 29709 +259
Branches 4252 4284 +32
=========================================
+ Hits 1885 1910 +25
- Misses 27278 27515 +237
+ Partials 287 284 -3
|
|
@tobiasKaminsky what about @mario's latest comment: #2524 (comment) ? |
|
Both loading url task are done when playing media, so I think it is fine. Beside that, there is somewhere an issue, where I started a discussion how to do long running background tasks, that maybe even survive activity rotate/open/close. --> I would keep it this way and later replace it with a potential better solution. |
Fine with me |
|
E.g. UserInfoActivity is the same: Of course, doing the same is not pushing the code to a better state, but I think we should find a better and generic approach first and then change it. |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
46a3694 to
8869e4c
Compare
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Lint
FindBugs (new)
FindBugs (master)
|
Needs:
Fixes: #379
This enables video/audio streaming without exposing any credentials.
Test cases:
NC14
NC13
Signed-off-by: tobiasKaminsky tobias@kaminsky.me